﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


using DBBase;
using System.Threading;
using System.Xml;

namespace Business
{
    public partial class Modify_Core : Form
    {
        public Modify_Core()
        {
            InitializeComponent();
        }
        public void getjilu()
        {
            list.Rows.Clear();
            Query mquery = new Query();
            string sql;
            sql = string.Format(@"SELECT session_server_principal_name, statement, event_time,action_id
                                FROM fn_get_audit_file ('E:\audit\table\hexinriji*',NULL, NULL)
                                where event_time>'{0}'  and event_time<'{1}' order by event_time desc ", dateTimePicker1.Value.ToShortDateString() + " 00:00:00", dateTimePicker2.Value.ToShortDateString() + " 23:59:59");
                DataTable dt = mquery.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        list.Rows.Add();
                        list.Rows[i].Cells[0].Value = string.Format("{0}", i + 1);
                        list.Rows[i].Cells[1].Value = dt.Rows[i]["session_server_principal_name"].ToString().Trim();
                        list.Rows[i].Cells[2].Value = dt.Rows[i]["action_id"].ToString().Trim();
                        list.Rows[i].Cells[3].Value = dt.Rows[i]["statement"].ToString().Trim();
                        list.Rows[i].Cells[4].Value = dt.Rows[i]["event_time"].ToString().Trim();
                    }
                }
        }
        private void but_query_Click(object sender, EventArgs e)
        {
            getjilu();
        }
    }
}
